package cn.sunzq.springdata.elasticsearch.demo.querydemo.enums;

/**
 * @创建人 孙中泉
 * @创建时间 2021/7/26
 * @描述
 */
public enum  ClientTypeEnum {
    ElasticsearchOperations(1),
    HighLevelClient(2);

    private int code;

    public static ClientTypeEnum getEnumByCode(int code){
        ClientTypeEnum[] values = ClientTypeEnum.values();
        for (ClientTypeEnum clientTypeEnum : values) {
            if(clientTypeEnum.code == code){
                return clientTypeEnum;
            }
        }
        return null;
    }
    ClientTypeEnum(int code) {
        this.code = code;
    }

    public int getCode() {
        return code;
    }
}
